<template>
  <div>
    <van-nav-bar title="我的" left-arrow @click-left="onClickLeft">
      <template #right> <van-icon name="ellipsis" size="18" /> </template
    ></van-nav-bar>
    <van-card
      :desc="info.nickName"
      :title="info.nickName"
      thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
    >
      <template #tags>
        个性签名：
        <van-tag plain type="danger">{{ info.introduceSign }}</van-tag>
      </template>
    </van-card>
    <van-cell title="我的订单" is-link />
    <van-cell title="账号管理" is-link />
    <van-cell title="地址管理" is-link />
    <van-cell title="关于我们" is-link />
  </div>
</template>

<script>
import { reactive, toRefs, computed, watch, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { getBaner, userinfo } from '../../request/api.js'
export default {
  setup(props) {
    const state = reactive({
      info: {},
    })
    const onClickLeft = () => history.back()
    const router = useRouter()
    onMounted(async () => {
      if (localStorage.getItem('token') !== null) {
        const { data } = await userinfo()
        state.info = data.data
        console.log(data)
      } else {
        router.push({ path: '/login' })
      }
    })
    return {
      onClickLeft,
      ...toRefs(state),
    }
  },
}
</script>
<style>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  text-align: center;
}
</style>
